home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / cursor.zip / CURSOR.PAS < prev   
Pascal/Delphi Source File  |  1991-01-19  |  2KB  |  75 lines

  1.  
  2. -------------------------------------------------------------------------------
  3.   TITLE : Cursor Definition
  4. -------------------------------------------------------------------------------
  5.      This is a sample program that demonstrates how to change the cursor
  6.      on an IBM PC.                                                           }
  7.  
  8. Program NoCursor;
  9.  
  10. var
  11.    ch : char;
  12. start,
  13. endcur : integer;
  14.  
  15. procedure SetCursor (StartLine,EndLine : Integer);
  16. {  This procedure does the actual cursor setting thru the TURBO
  17.    INTR procedure                                                }
  18.  
  19. type Registers = record
  20.                  ax,bx,cx,dx,bp,si,ds,es,flags : integer;
  21.                  end;
  22.  
  23. var
  24.    RegPack : Registers;
  25. CxRegArray : Array [1..2] of Byte;
  26.      CxReg : integer absolute CxRegArray;
  27.  
  28. begin
  29.      CxRegArray [2] := Lo (StartLine);
  30.      CxRegArray [1] := Lo (EndLine);
  31.      With RegPack do
  32.           begin
  33.                ax := $0100;          {ah = 1 means set cursor type         }
  34.                bx := $0;             {bx = page number, zero for us        }
  35.                cx := CxReg;          {cx bits 4 to 0 = start line for      }
  36.                                      {Cursor                               }
  37.                                      {cl bits 4 to 0 = end line for cursor }
  38.                intr ($10,RegPack);   {set cursor                           }
  39.           end;
  40. end;
  41.  
  42. procedure BoxCursor;
  43. {  This procedure calls SetCursor to show a block (box) cursor  }
  44.  
  45. begin
  46.      SetCursor (2,5);
  47. end;
  48.  
  49. {-----------------------------------------------------------------------------
  50.   TITLE : Cursor Definition
  51. ------------------------------------------------------------------------------}
  52.  
  53. procedure NoCursor;
  54. { This procedure calls SetCursor to turn the cursor off                    }
  55.  
  56. begin
  57.      SetCursor (32,0);      {Setting bit 5 turns off cursor                }
  58. end;
  59.  
  60. procedure ULCursor;
  61. { This procedure calls SetCursor to show the 'underscore' cursor           }
  62.  
  63. begin
  64.      SetCursor (6,7);
  65. end;
  66.  
  67.  
  68. begin
  69.      write ('Box:'); BoxCursor; read (kbd, ch); writeln;
  70.      write ('No:'); NoCursor; read (kbd, ch); writeln;
  71.      write ('UL:'); ULCursor; read (kbd, ch); writeln;
  72. end.
  73.  
  74.  
  75.